package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;
import com.icode.service.house.HouseService;
import com.icode.service.impl.house.HouseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;

import javax.persistence.*;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: SunKai
 * Date: 14-11-15
 * Time: 下午4:22
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "equipment")
public class Equipment extends AbstractEntity {
    @Column
    private String name;

    @Column
    @Enumerated(EnumType.STRING)
    private EquipmentType type;

    @Autowired
    private static HouseService houseService;


    public Equipment() {
        if (houseService == null) {
            houseService = new HouseServiceImpl();
        }
    }

    public Equipment(String name, EquipmentType type) {
        this.name = name;
        this.type = type;
    }

    public String name() {
        return name;
    }

    public EquipmentType type() {
        return type;
    }

    public void updataName(String name) {
        this.name = name;
    }
}
